-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolve: Do not use "resolve"/"resolution" in error messages #38890
Conversation
Seems good for me. Thanks for your work! |
I like the idea of changing the wording for better readability. I'm not 100% yet on "value Curious to hear what @nikomatsakis thinks, but how does "value |
LGTM, I like the wording. @jonathandturner I feel like 'declared' and 'scope' are not as bad as 'resolution' - the former are programming jargon, but the latter is compiler jargon. So while it is not perfect, it is much better. I'm wary about using 'visible' since it seems easy to confuse with visibility (is a variable declared in a scope, vs is the variable accessible from that scope). r=me, but leaving open for a few days for discussion of wording. |
Strong 👍 on shifting away from "resolved". I have to admit I find it hard to imagine not knowing the word "declaration", but I can appreciate that I am biased and that this might well be the case for some users! That said, I don't like the precise wording of "value Foo is not visible from here" -- the problem is that, to me, that implies that |
Compare messages for
In the second case we tell that we can't find |
What about "cannot find ... in scope"? With the notes being about something with that name being "found elsewhere". This seems better than mentioning declarations which can be confusing wrt imports and other things. |
Base 1: LGTM (except for label 2), but I have nothing against "declared" so I like my variant better. |
@petrochenkov one think that gives me pause about "declared" is that I think of a declaration as being something like |
I think mentioning |
I'm still interested in better suggestions for "Label 2". |
@petrochenkov what an example for label 2? I see the pattern, but what does it look like a real example? |
@jonathandturner
Diagnostics:
(Note that path segments don't have individual spans now, so the label has to point to the whole path.) |
I think it's okay to also use "not in scope" here, too |
I wonder why this isn't/can't be "cannot find value EDIT:
We should just fix this, it's been bothering me for other reasons (per-segment lifetime/type parameters). |
Oh, that's just a typo (I modified the error message manually), fixed.
Ok, I'll use "not in |
☔ The latest upstream changes (presumably #38925) made this pull request unmergeable. Please resolve the merge conflicts. |
New messages are looking good. 👍 |
6a5a605
to
2c6fa8a
Compare
Updated. |
@bors: r+ |
📌 Commit 2c6fa8a has been approved by |
2c6fa8a
to
2092682
Compare
Fixed wrongly updated UI test caught by travis |
📌 Commit 2092682 has been approved by |
⌛ Testing commit 2092682 with merge 2768428... |
💔 Test failed - status-appveyor |
dist failure (appveyor s3 bindings) |
⌛ Testing commit 2092682 with merge 31f0c9d... |
💔 Test failed - status-travis |
@bors: retry
|
⌛ Testing commit 2092682 with merge 3e5621b... |
⌛ Testing commit 2092682 with merge 1d5fb06... |
resolve: Do not use "resolve"/"resolution" in error messages Use less jargon-y wording instead. `cannot find <struct> <S> in <this scope>` and `cannot find <struct> <S> in <module a::b>` are used for base messages (this also harmonizes nicely with "you can import it into scope" suggestions) and `not found in <this scope>` and `not found in <a::b>` are used for short labels in fall-back case. I tweaked some other diagnostics to avoid using "resolve" (see, e.g., `librustc_resolve/macros.rs`), but haven't touched messages for imports. Closes #38750 r? @nrc
☀️ Test successful - status-appveyor, status-travis |
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes rust-lang#38927 (comment) rust-lang#38890 (comment) r? @nrc @eddyb
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes rust-lang#38927 (comment) rust-lang#38890 (comment) r? @nrc @eddyb
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes rust-lang#38927 (comment) rust-lang#38890 (comment) r? @nrc @eddyb
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes rust-lang#38927 (comment) rust-lang#38890 (comment) r? @nrc @eddyb
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes rust-lang#38927 (comment) rust-lang#38890 (comment) r? @nrc @eddyb
Use less jargon-y wording instead.
cannot find <struct> <S> in <this scope>
andcannot find <struct> <S> in <module a::b>
are used for base messages (this also harmonizes nicely with "you can import it into scope" suggestions) andnot found in <this scope>
andnot found in <a::b>
are used for short labels in fall-back case.I tweaked some other diagnostics to avoid using "resolve" (see, e.g.,
librustc_resolve/macros.rs
), but haven't touched messages for imports.Closes #38750
r? @nrc